import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { UserWalletVO, UserWalletForm, UserWalletQuery } from '@/api/system/userWallet/types';

/**
 * 查询用户钱包列表
 * @param query
 * @returns {*}
 */

export const listUserWallet = (query?: UserWalletQuery): AxiosPromise<UserWalletVO[]> => {
  return request({
    url: '/system/userWallet/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询用户钱包详细
 * @param walletId
 */
export const getUserWallet = (walletId: string | number): AxiosPromise<UserWalletVO> => {
  return request({
    url: '/system/userWallet/' + walletId,
    method: 'get'
  });
};

/**
 * 新增用户钱包
 * @param data
 */
export const addUserWallet = (data: UserWalletForm) => {
  return request({
    url: '/system/userWallet',
    method: 'post',
    data: data
  });
};

/**
 * 修改用户钱包
 * @param data
 */
export const updateUserWallet = (data: UserWalletForm) => {
  return request({
    url: '/system/userWallet',
    method: 'put',
    data: data
  });
};

/**
 * 删除用户钱包
 * @param walletId
 */
export const delUserWallet = (walletId: string | number | Array<string | number>) => {
  return request({
    url: '/system/userWallet/' + walletId,
    method: 'delete'
  });
};
